import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import App from './containers/app'

// 按模块导入lodash，可以有效减小vendor.js的大小
import isEmpty from 'lodash/isEmpty'
import isEqual from 'lodash/isEqual'
import debounce from 'lodash/debounce'
import isArray from 'lodash/isArray'

window.isEmpty = isEmpty
window.isEqual = isEqual
window.debounce = debounce
window.isArray = isArray

const render = component => {
  ReactDOM.render(
    <AppContainer>
      {component}
    </AppContainer>,
    document.getElementById('root')
  )
}

render(<App />)

if (module.hot) {
  module.hot.accept('./containers/app', () => { render(<App />) })
}
